package br.com.cadele.beans;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

import br.com.cadele.model.Professor;
import br.com.cadele.service.ProfessorService;

@ManagedBean(name="cadastrarProfessorBean")
@ViewScoped
@URLBeanName(value="cadastrarProfessorBean")
@URLMapping(id="cadastrarProfessorBean", pattern="/professor/cadastrar", viewId="/pages/professor/cadastrar.xhtml")
public class CadastrarProfessorBean implements Serializable{

	private static final long serialVersionUID = 6363504581942703741L;
	private Professor professor;
	private ProfessorService professorService;
	
	@PostConstruct
	private void init() {
		professor = new Professor();
		professorService = new ProfessorService();
	}
	
	public void salvar() {
		professorService.executeInsert(professor);
	}
	
	public Professor getProfessor() {
		return professor;
	}
	
	public void setProfessor(Professor professor) {
		this.professor = professor;
	}
	
	
}
